<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	request.setAttribute("path", path);//只是为了让el表达式更短一些
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="expires" content="0">
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="This is my page">
<link rel="icon" href="favicon.ico">

<!-- Bootstrap core CSS -->
<link href="${path}/res/css/bootstrap(2).min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<link href="${path}/res/css/bootstrap-theme.min.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="${path}/res/js/html5shiv.min.js"></script>
      <script src="${path}/res/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="container" ng-app="myapp">
	<jsp:include page="/header.jsp"></jsp:include>
	<!-- =======================header=========================== -->
	
			<div class="row" style="margin-top: 20px;">
			<div class="panel-group" role="tablist">
				<div class="panel panel-default">
					<div class="panel-heading panel-title"
						id="collapseListGroupHeading1">
						<div class="row">
							<div class="col-sm-1 col-xs-1 text-center">#</div>
							<div class="col-sm-3 col-xs-3 text-center">名称</div>
							<div class="col-sm-2 col-xs-2 text-center">课程</div>
							<div class="col-sm-2 col-xs-2 text-center">类型</div>
							<div class="col-sm-3 col-xs-3 text-center">附件</div>
							<div class="col-sm-1 col-xs-1 text-center">操作</div>
						</div>
					</div>

					<div class="panel-collapse" id="task_panel"
						ng-controller='SearchController' role="tabpanel"
						aria-labelledby="collapseListGroupHeading1" aria-expanded="true">
						<ul class="list-group">
							<li class="list-group-item" ng-repeat="row in results"
								ng-mouseover="mousein($index)">
								<div class="row" data-toggle="tooltip" data-placement="left"
									title="{{row.type}}">
									<div class="col-sm-1 col-xs-1 text-center" ng-bind="$index"></div>
									<div class="col-sm-3 col-xs-3 text-center" ng-bind="row.name"
										data-toggle="collapse" data-target="#demo{{$index}}"
										style="cursor: pointer;"></div>
									<div class="col-sm-2 col-xs-2 text-center" ng-bind="row.teachName"></div>
									<div class="col-sm-2 col-xs-2 text-center" ng-bind="row.type"></div>
									<!-- 没有附件的情况 -->
									<div class="col-sm-3 col-xs-3 text-center"
										ng-if="row.fileID == -1" ng-bind="row.fileName"></div>
									<!-- 有附件的情况 -->
									<div class="col-sm-3 col-xs-3 text-center"
										ng-if="row.fileID != -1">
										<a href="javascript:void(0)" ng-click="download($index)"
											data-toggle="tooltip" data-placement="left" title="下载"> <span
											class="glyphicon glyphicon-link">&nbsp;{{row.fileName}}</span></a>
									</div>
									<div class="col-sm-1 col-xs-1 text-center"
										ng-show='$index == selectedRow'>

									<!-- 	<a href="javascript:void(0);" ng-click="submit($index)" ng-if="row.isExpired == 0"
											data-toggle="tooltip" data-placement="left" title="提交作业">
											<span class="glyphicon glyphicon-edit"></span>
										</a>
										<span ng-if="row.isExpired == 1">已过期</span> -->
									</div>
								</div>
								<div id="demo{{$index}}" class="collapse" ng-bind="row.content"></div>
							</li>
						</ul>

					</div>
				</div>
			</div>
		</div>

	<!-- ========================footer========================== -->
	<jsp:include page="/footer.jsp"></jsp:include>
	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="${path}/res/js/jquery.min.js"></script>
	<script src="${path}/res/js/bootstrap.min.js"></script>
	<script src="${path}/res/js/angular.min.js"></script>
	<script src="${path}/res/js/search.js"></script>
	<script type="text/javascript">
		var result = '${resultJson}';		
	</script>
</body>
</html>
